package cn.kgc.fcm.dsbank.enumtest;

public class EnumTest02 {

    enum Color{
        RED,GREEN,BLUE
    }

    enum Size{
        BIG,MIDDLE,SMALL
    }

    public static void main(String[] args) {
        System.out.println("输出所有的颜色");
        //遍历输出枚举中定义的所有的值
        for (Color value : Color.values()) {
            System.out.println(value);
        }

        System.out.println("输出所有的尺寸");
        for (Size value : Size.values()) {
            System.out.println(value);
        }
        System.out.println("++++++++++++++");
        //遍历输出枚举中定义的所有的值的编号
        for (Color value : Color.values()) {
            System.out.println(value.ordinal());
        }

        System.out.println("输出所有的尺寸");
        for (Size value : Size.values()) {
            System.out.println(value.ordinal());
        }

        System.out.println("+++++++++++++++++");
        Color color = Color.RED;
        System.out.println(color);
        System.out.println(color.name());
        System.out.println(color.getDeclaringClass());

        System.out.println(color.hashCode());
        System.out.println(color.compareTo(Color.RED));

        System.out.println(color == Color.RED);


    }
}
